using APP.HELPER.Data.Helper;
using System;

namespace Service
{
    internal class Keycode
    {
        private int _mIdKey;
        private string _mKeyCode;
        private int _mIdContact;
        private DateTime _mDateCreate;
        private string _mProperty;
        private int _mNumActive;
        private int _mActivated;
        private bool _mBlacklist;
        private int _mTypeActive;
        private int _mTypeSoft;
        private DateTime _mDateLimit;
        private bool _mRegister;
        public int Id_Key
        {
            get
            {
                return this._mIdKey;
            }
            set
            {
                this._mIdKey = value;
            }
        }
        public string KeyCode
        {
            get
            {
                return this._mKeyCode;
            }
            set
            {
                this._mKeyCode = value;
            }
        }
        public int Id_Contact
        {
            get
            {
                return this._mIdContact;
            }
            set
            {
                this._mIdContact = value;
            }
        }
        public DateTime DateCreate
        {
            get
            {
                return this._mDateCreate;
            }
            set
            {
                this._mDateCreate = value;
            }
        }
        public string Property
        {
            get
            {
                return this._mProperty;
            }
            set
            {
                this._mProperty = value;
            }
        }
        public int NumActive
        {
            get
            {
                return this._mNumActive;
            }
            set
            {
                this._mNumActive = value;
            }
        }
        public int Activated
        {
            get
            {
                return this._mActivated;
            }
            set
            {
                this._mActivated = value;
            }
        }
        public bool Blacklist
        {
            get
            {
                return this._mBlacklist;
            }
            set
            {
                this._mBlacklist = value;
            }
        }
        public int TypeActive
        {
            get
            {
                return this._mTypeActive;
            }
            set
            {
                this._mTypeActive = value;
            }
        }
        public int TypeSoft
        {
            get
            {
                return this._mTypeSoft;
            }
            set
            {
                this._mTypeSoft = value;
            }
        }
        public DateTime DateLimit
        {
            get
            {
                return this._mDateLimit;
            }
            set
            {
                this._mDateLimit = value;
            }
        }
        public bool Register
        {
            get
            {
                return this._mRegister;
            }
            set
            {
                this._mRegister = value;
            }
        }
        public Keycode()
        {
            this._mIdKey = 0;
            this._mKeyCode = "";
            this._mIdContact = 0;
            this._mDateCreate = DateTime.Now;
            this._mProperty = "";
            this._mNumActive = 0;
            this._mActivated = 0;
            this._mBlacklist = true;
            this._mTypeActive = 0;
            this._mTypeSoft = 0;
            this._mDateLimit = DateTime.Now;
            this._mRegister = true;
        }
        public string Get(string KeyCode)
        {
            string result = "";
            object[] parameterValues = new object[]
			{
				KeyCode
			};
            SqlHelper sqlHelper = new SqlHelper("tOPIxxYos7q7KFheUFh/Zczhu/5hC5PryXFA1850bvhMqXE3+8cmhNLR18eIZqCc+X31s2MsNck=", "07071983", true);
            result = "OK";
            //SqlHelper sqlHelper = new SqlHelper("HPqrGX/piQz0Xe4u/h/67gQ3uyF/l8Jnvceflfn0g5a097J0Dujgoj8bqG7F7buoYB2Mt+NKyXJ77rNdpJJ69tNga+CVb/KOMzARhvb5JWkXymCWnUJWzzgLCgblpEMy", "07071983", true);
            //SqlDataReader sqlDataReader = SqlHelper.ExecuteReader(sqlHelper.ConnectionString, "KEYCODE_GetByKeyCode", parameterValues);
            //if (sqlDataReader != null)
            //{
            //    while (sqlDataReader.Read())
            //    {
            //        this._mIdKey = Convert.ToInt32(sqlDataReader["Id_Key"]);
            //        this._mKeyCode = Convert.ToString(sqlDataReader["KeyCode"]);
            //        this._mIdContact = Convert.ToInt32(sqlDataReader["Id_Contact"]);
            //        this._mDateCreate = Convert.ToDateTime(sqlDataReader["DateCreate"]);
            //        this._mProperty = Convert.ToString(sqlDataReader["Property"]);
            //        this._mNumActive = Convert.ToInt32(sqlDataReader["NumActive"]);
            //        this._mActivated = Convert.ToInt32(sqlDataReader["Activated"]);
            //        this._mBlacklist = Convert.ToBoolean(sqlDataReader["Blacklist"]);
            //        this._mTypeActive = Convert.ToInt32(sqlDataReader["TypeActive"]);
            //        this._mTypeSoft = Convert.ToInt32(sqlDataReader["TypeSoft"]);
            //        this._mDateLimit = Convert.ToDateTime(sqlDataReader["DateLimit"]);
            //        this._mRegister = Convert.ToBoolean(sqlDataReader["Register"]);
            //        result = "OK";
            //    }
            //    sqlDataReader.Close();
            //    sqlHelper.Close();
            //}
            return result;
        }
    }
}